package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BasePageResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseSelectResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.phase.*;
import com.zmj.sy.mom.srv.aps.service.PhaseBossService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "工序-首席配置")
@RestController
@RequestMapping("/phaseBoss")
public class PhaseBossController {

    private final PhaseBossService phaseBossService;

    @ApiOperation("首席查询")
    @GetMapping("/bossList")
    public BasePageResVo<PhaseBossSelectResVo> bossList(PhaseBossSelectReqVo reqVo){
        return phaseBossService.bossList(reqVo);
    }

    @ApiOperation("首席添加")
    @PostMapping("/bossAdd")
    public BaseResVo bossAdd(@RequestBody PhaseBossAddReqVo reqVo){
        phaseBossService.bossAdd(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("首席编辑")
    @PostMapping("/bossEdit")
    public BaseResVo bossEdit(@RequestBody PhaseBossEditReqVo reqVo){
        phaseBossService.bossEdit(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("首席删除")
    @PostMapping("/bossDelete")
    public BaseResVo bossDelete(BaseIdReqVo reqVo){
        phaseBossService.bossDelete(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("下拉框")
    @GetMapping("/bossSelect")
    public BaseSelectResVo bossSelect(PhaseBossSelect2ResVo reqVo){
        return BaseSelectResVo.of(phaseBossService.bossSelect(reqVo));
    }

}
